home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 13 January 1998
- //
- // Description:
- //
- //
- // Procedure Name:
- // performPolyBoolean
- //
- // Description:
- // perform a boolean operation of the selected polygon objects
- //
- // Input Arguments:
- // $option : Whether to set the options to default values.
- // Return Value:
- // command string iff $option==2
- //
-
- proc setOptionVars (int $forceFactorySettings)
- {
- if ($forceFactorySettings || !`optionVar -exists polyBooleanType`)
- optionVar -intValue polyBooleanType 1;
- }
-
- global proc performPolyBooleanSetup (string $parent, int $forceFactorySettings)
- {
- setOptionVars($forceFactorySettings);
- setParent $parent;
-
- int $val = `optionVar -query polyBooleanType`;
- optionMenuGrp -edit -sl $val polyBooleanType;
- // intSliderGrp -edit -value $val polyBooleanType;
- }
-
- global proc performPolyBooleanCallback (string $parent, int $doIt)
- {
- setParent $parent;
- optionVar -intValue polyBooleanType
- `optionMenuGrp -query -sl polyBooleanType`;
- if ($doIt) {
- performPolyBoolean 0;
- addToRecentCommandQueue "performPolyBoolean 0" "PolyBoolean";
- }
- }
-
- proc polyBooleanOptions ()
- {
- string $commandName = "performPolyBoolean";
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- string $layout = getOptionBox();
- setParent $layout;
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- // intSliderGrp -label "Operation" -min 1 -max 10 -s 1 polyBooleanType;
- optionMenuGrp -l "Operation" polyBooleanType;
- menuItem -l "Union" BooleanUnionMenuItem;
- menuItem -l "Difference" BooleanDifferenceMenuItem;
- menuItem -l "Intersection" BooleanIntersectionMenuItem;
- setParent -m ..;
- optionMenuGrp -e -sl 1 polyBooleanType;
-
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit -label "Boolean"
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- setOptionBoxTitle("Polygon Boolean Options");
-
- setOptionBoxHelpTag( "PolyBoolean" );
-
- eval (($setup + " " + $parent + " " + 0));
- showOptionBox();
- }
-
- global proc string performPolyBoolean (int $option)
- {
- string $cmd="";
- string $sel[];
- switch ($option) {
- case 0:
- setOptionVars(false);
- int $ival = `optionVar -query polyBooleanType`;
- $cmd = "polyBoolOp " + " -op " + $ival;
- polyPerformAction $cmd o 0;
- break;
- case 1: polyBooleanOptions; break;
- default:
- setOptionVars(false);
- int $ival = `optionVar -query polyBooleanType`;
- $cmd = "polyBoolOp " + " -op " + $ival;
- $cmd = ("polyPerformAction \"" + $cmd + "\" o 0");
- }
- return $cmd;
- }
-